package de.itagile.hypersphere

class EntityFieldTemplate extends Template {
	
	def getField() {
		return {field ->
		 	"private ${field.type} ${field.name};" 
		}
	}
	
	def getGetter() { 
		return {field ->
			String fieldname = field.name
			[
			 '@Column(name = "' + "${field.column}" + '")',
			 "public ${field.type} get${toFirstUpper(fieldname)}() {",
				 "return $fieldname;",
		     "}"
		     ]
		}
	}

	def getSetter() { 
		return {field -> 
			String fieldname = field.name
		    [
		        "public void set${toFirstUpper(fieldname)}(${field.type} $fieldname) {",
		            "this.$fieldname = $fieldname;",
		        "}"
		    ]
		}
	}
}